import axios from 'axios'
import Nprogress from 'nprogress'

const request = axios.create({
    //baseURL: 'http://42.193.101.229:3000/'
    baseURL: 'http://localhost:3000/'
})

//在request拦截器中展示进度条
request.interceptors.request.use(config => {
    Nprogress.start()
    return config //在最后必须return
})

//在response拦截器中隐藏进度条
request.interceptors.response.use(response => {
    Nprogress.done()
    return response.data //在最后也必须return
})

export {request}
